package com.itheima.ManyToOne;

import com.itheima.bean.Student;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface StudentMapper {
    @Select("select * from student")
    @Results({
            @Result(id =true,property = "id",column = "id"),
            @Result(property = "name",column = "sname"),
            @Result(property = "age",column = "age"),
            @Result(property = "classes",column ="cid",
            javaType = List.class,
            one = @One(select = "com.itheima.ManyToOne.ClassesMapper.findByCid")
            ),
    })
    List<Student>  findAll();
}
